X-Git-Url: https://git.r.bdr.sh/rbdr/Flat-Bezel.qsplugin/blobdiff_plain/6c2cdbc5ffb3ec1775c25d122751bddc5d205b6a..80583e8f2fb92146b8c59e36636f690af7f13eb0:/Flat%20Bezel/BBObjectCell.m diff --git a/Flat Bezel/BBObjectCell.m b/Flat Bezel/BBObjectCell.m index 40bde4d..7bf1b3c 100644 --- a/Flat Bezel/BBObjectCell.m +++ b/Flat Bezel/BBObjectCell.m @@ -27,7 +27,7 @@ [strokeColor setStroke]; NSBezierPath *roundRect = [NSBezierPath bezierPath]; - [roundRect appendBezierPathWithRoundedRectangle:cellFrame withRadius:cellRadiusFactor]; + [roundRect appendBezierPathWithRoundedRectangle:cellFrame withRadius:NSHeight(cellFrame)/cellRadiusFactor]; [roundRect fill]; [self drawInteriorWithFrame:[self drawingRectForBounds:cellFrame] inView:controlView]; @@ -157,4 +157,55 @@ } } +- (void)drawIconForObject:(QSObject *)object withFrame:(NSRect)cellFrame inView:(NSView *)controlView { + NSImage *image = [object icon]; + NSString *iconName = nil; + NSImageSymbolConfiguration *iconConfig = nil; + if ([[image name] isEqualToString: @"defaultAction"]) { + iconName = @"gearshape.circle"; + } + else if ([[image name] isEqualToString: @"Find"]) { + iconName = @"magnifyingglass"; + } + else if ([[image name] isEqualToString: @"Object"]) { + iconName = @"cube.transparent"; + iconConfig = [NSImageSymbolConfiguration configurationWithHierarchicalColor:[NSColor controlAccentColor]]; + } + else if ([[image name] isEqualToString: @"ContactAddress"]) { + iconName = @"mappin.circle"; + } + else if ([[image name] isEqualToString: @"ContactEmail"]) { + iconName = @"envelope.circle"; + } + else if ([[image name] isEqualToString: @"ContactPhone"]) { + iconName = @"phone.circle"; + } + else if ([[image name] isEqualToString: @"DefaultBookmarkIcon"]) { + iconName = @"link.circle"; + } + else if ([[image name] isEqualToString: @"Catalog"]) { + iconName = @"sparkles.rectangle.stack"; + } + else if ([[image name] isEqualToString: @"Triggers"]) { + iconName = @"bolt.fill"; + } + + + if (iconName != nil) { + NSImage *newIcon = [NSImage imageWithSystemSymbolName:iconName accessibilityDescription:[image name]]; + + if (iconConfig == nil) { + NSArray *colors = [NSArray arrayWithObjects:[NSColor textColor], [NSColor controlAccentColor], nil]; + iconConfig = [NSImageSymbolConfiguration configurationWithPaletteColors:colors]; + } + + QSObject *newObject = [QSObject objectWithName:[object name]]; + [newObject setIcon:[newIcon imageWithSymbolConfiguration:iconConfig]]; + [newObject setIconLoaded:[object iconLoaded]]; + return [super drawIconForObject: newObject withFrame:cellFrame inView:controlView]; + } + + [super drawIconForObject: object withFrame:cellFrame inView:controlView]; +} + @end